package common

import (
	"context"
	"sale-admin/internal/app/grpc/client"
	"sale-admin/internal/app/grpc/protoc/system_admin"

	"192.168.1.75/go-pkg/errorx"
)

// GetFamilyMerchants 获取直系商户
func GetFamilyMerchants(ctx context.Context, merchantID string) (merchantIDs []string, err error) {
	cli, err := client.GetSystemAdminClient()
	if err != nil {
		return []string{}, errorx.New("获取直系商户失败-cli", -1)
	}
	rsp, err := cli.GetFamilyMerchants(ctx, &system_admin.FamilyMerchantsReq{
		MerchantId: merchantID,
	})
	if err != nil {
		return []string{}, errorx.New("获取直系商户失败", -1)
	}
	return rsp.MerchantIds, nil
}
